package com.jintoufs.interceptor;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

import org.cosmos.modules.utils.encode.EncodesUtils;

public class BaseInterceptor {
	
//	protected static Cookie getCookieByName(HttpServletRequest request,
//			String name) {
//		Map<String, Cookie> cookieMap = ReadCookieMap(request);
//		if (cookieMap.containsKey(name)) {
//			Cookie cookie = (Cookie) cookieMap.get(name);
//			return cookie;
//		} else {
//			return null;
//		}
//	}
	
//	protected static String getCookieValueByName(HttpServletRequest request,
//			String name) {
//		Cookie cookie=getCookieByName(request, name);
//		if(cookie==null){
//			return "";
//		}
//		return EncodesUtils.urlDecode(cookie.getValue());
//	}
	
//	private static Map<String, Cookie> ReadCookieMap(HttpServletRequest request) {
//		Map<String, Cookie> cookieMap = new HashMap<String, Cookie>();
//		Cookie[] cookies = request.getCookies();
//		if (null != cookies) {
//			for (Cookie cookie : cookies) {
//				cookieMap.put(cookie.getName(), cookie);
//			}
//		}
//		return cookieMap;
//	}

}
